package com.itheima.day_07;
/*请定义一个描述矩形（MyRectangle）的类，包含宽和高两个属性，
提供获取矩形周长（perimeter）和面积（area）的方法。并编写测试类进行测试。*/
public class MyRectangle {
    private double length;
    private double width;

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public MyRectangle() {
    }

    public MyRectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    public double getPerimeter(){
        double perimeter = (this.length + this.width)*2;
        return perimeter;
    }

    public double getArea(){
        double area = this.length * this.width;
        return area;
    }
}


class Test06{

    public static void main(String[] args) {
        MyRectangle my = new MyRectangle(3.0,4.0);
        System.out.println(my.getPerimeter());
        System.out.println(my.getArea());

    }

}